# Contributor: Runar Tenfjord < runar dot tenfjord at gmail dot com >

_realname=six
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=1.15.0
pkgrel=1
pkgdesc="Python 2 and 3 compatibility utilities (mingw-w64)"
arch=('any')
url="https://pypi.python.org/pypi/six/"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python")
source=(https://pypi.io/packages/source/${_realname:0:1}/${_realname}/${_realname}-${pkgver}.tar.gz)
sha256sums=('30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259')

prepare() {
  cd "${srcdir}"
  cp -r six-${pkgver} python-build-${CARCH}
}

build() {
  msg "Python build for ${CARCH}"
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

check() {
  cd ${srcdir}/python-build-${CARCH}
  ${MINGW_PREFIX}/bin/python setup.py check
}

package() {
  cd ${srcdir}/python-build-${CARCH}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
        --root "${pkgdir}" --optimize=1 --skip-build

  install -Dm644 "${srcdir}/six-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
